package mystudy.oop;

import com.sun.xml.internal.bind.v2.runtime.output.StAXExStreamWriterOutput;

import java.util.function.DoubleToIntFunction;

public class People {
    private int age;
    private char gentel;

    int getAge()
    {
        return this.age;
    }

    void setAge(int age) {
       if(age>=0&&age<=100)
       {
           this.age=age;
       }
        else
        {
            System.out.println("年龄超出合理范围，已设成默认值20");
            this.age = 20;
        }
    }


    int Gentel()
    {
        return this.gentel;
    }
     void setGentel(int gentel) {
        if(gentel=='男')
        {
            this.gentel = '男';
        }
        else if(gentel=='女')
        {
            this.gentel = '女';
        }
        else
        {
            System.out.println("性别设置错误，已将性别设置成默认值男");
            this.gentel = '男';
        }
    }

    void self()
    {
        System.out.printf("我的性别是：%s\t 我的年龄是：%d",this.gentel,this.age);
    }
}
